<template>
  <transition name="el-zoom-in-center">
    <div class="JNPF-common-layout">
      <div class="JNPF-preview-main">
        <el-page-header @back="goBack" content="合同列表"/>


        <el-col :span="24">
          <el-row :gutter="10">
            <el-col :span="24" style="display: flex">
              <div style="display: flex;right: 0px;position: absolute;margin-top: 10px">
<!--                <jnpf-button-->
<!--                  style="width: 120px"-->
<!--                  align="right" buttonText="合同续签" type="primary" :closable="false"-->
<!--                >-->
<!--                </jnpf-button>-->
<!--                <jnpf-button style="width: 120px" @click="billCollection()"-->
<!--                             align="right" buttonText="合同变更" type="primary" :closable="false"-->
<!--                >-->
<!--                </jnpf-button>-->

<!--                <jnpf-button style="width: 120px" @click="toBllReduce()"-->
<!--                             align="right" buttonText="合同终止" type="primary" :closable="false"-->
<!--                >-->
<!--                </jnpf-button>-->
                <jnpf-button style="width: 120px" @click="htPrint('676328942910595013',dataForm.id)"
                             align="right" buttonText="合同套打" type="primary" :closable="false"
                >
                </jnpf-button>

              </div>
            </el-col>
          </el-row>
        </el-col>
        <el-card style="min-height: 200px">
          <el-row :gutter="10" class=" main" :style="{margin: '0 auto',width: '100%'}">
            <el-form ref="elForm" :model="dataForm" size="small" label-width="180px"
                     label-position="right">
              <el-col :span="24">

                <el-form-item label-width="100">
                  <groupTitle style="margin-left: 21px"
                              content-position="left" :closable="false" content="基础信息"
                  >
                  </groupTitle>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-row :gutter="10" style="margin-left: 21px">
                  <el-col :span="6">
                    <el-form-item label="合同编号:" label-width="100">
                      <p>{{ dataForm.contractNumber }}</p>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item  label="合同状态:" label-width="100">
                          <el-tag v-if="dataForm.flowState==1">等待审核</el-tag>
                          <el-tag type="success" v-else-if="dataForm.flowState==2">审核通过</el-tag>
                          <el-tag type="danger" v-else-if="dataForm.flowState==3">审核驳回</el-tag>
                          <el-tag type="info" v-else-if="dataForm.flowState==4">流程撤回</el-tag>
                          <el-tag type="info" v-else-if="dataForm.flowState==5">审核终止</el-tag>
                          <el-tag type="warning" v-else>等待提交</el-tag>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label-width="100">
                      <el-form-item label="备注:" label-width="100">
                        <p>{{ dataForm.notes }}</p>
                      </el-form-item>
                    </el-form-item>
                  </el-col>

                </el-row>
              </el-col>
            </el-form>
          </el-row>
        </el-card>


        <el-tabs v-model="active" @tab-click="handleClick">
          <el-tab-pane label="基础信息" name="0"></el-tab-pane>
          <el-tab-pane label="商务条款" name="1"></el-tab-pane>
          <el-tab-pane label="收款计划" name="2"></el-tab-pane>
          <el-tab-pane label="其他条款" name="3"></el-tab-pane>
        </el-tabs>

        <!--        <el-steps :active="active" finish-status="success">-->
        <!--        <el-steps :active="active" finish-status="success">-->
        <!--          <el-step title="基础信息"></el-step>-->
        <!--          <el-step title="商务条款"></el-step>-->
        <!--          <el-step title="收款计划"></el-step>-->
        <!--          <el-step title="其他条款"></el-step>-->
        <!--        </el-steps>-->

        <!--    <el-button style="margin-top: 12px;" @click="next">下一步</el-button>-->
        <!--    <el-button style="margin-top: 12px;" @click="nextS">上一步</el-button>-->
        <el-row >


          <el-form ref="elForm" :disabled="setting.readonly" :model="dataForm" :rules="dataRule" label-position="right"
                   label-width="140px" size="medium"
                   style="color: black!important;"
          >
            <template v-if="!loading ">
              <!--            <template v-if="!loading">-->
              <el-col :span="24">

                <div v-if="active==0">
                  <!--              <el-col :span="6" v-if="!setting.readonly"-->
                  <!--              >-->
                  <!--                <el-form-item label="流程标题"-->
                  <!--                              prop="title"-->
                  <!--                >-->
                  <!--                  <el-input  v-model="dataForm.title"-->
                  <!--                            placeholder="请输入"  clearable-->
                  <!--                            :style='{"width":"100%"}'-->
                  <!--                  >-->

                  <!--                  </el-input>-->
                  <!--                </el-form-item>-->
                  <!--              </el-col>-->
                  <el-col :span="6" v-if="judgeShow('contractNumber')"
                  >
                    <el-form-item label="合同编号" prop="contractNumber">
                      <el-input v-model="dataForm.contractNumber"
                                placeholder="请输入"
                                :disabled="judgeWrite('contractNumber')"
                                clearable
                                :style='{"width":"100%"}'>
                      </el-input>
                    </el-form-item>
                  </el-col>

                  <el-col :span="6" v-if="judgeShow('nbContractNumber')"
                  >
                    <el-form-item label="内部合同编号" prop="nbContractNumber">
                      <el-input v-model="dataForm.nbContractNumber"
                                placeholder="请输入"
                                :disabled="judgeWrite('nbContractNumber')"
                                clearable
                                :style='{"width":"100%"}'>
                      </el-input>
                    </el-form-item>
                  </el-col>

                  <el-col :span="6" v-if="judgeShow('contractHandler')"
                  >
                    <el-form-item label="合同经办人"
                                  prop="contractHandler"
                    >
                      <user-select v-model="dataForm.contractHandler"
                                   placeholder="请选择" :disabled="judgeWrite('contractHandler')" clearable
                      >

                      </user-select>
                    </el-form-item>
                  </el-col>

                  <el-col :span="6" v-if="judgeShow('project')"
                  >

                  </el-col>

                  <el-col :span="6" v-if="judgeShow('signingDate')"
                  >
                    <el-form-item label="合同签订日期"
                                  prop="signingDate"
                    >
                      <el-date-picker v-model="dataForm.signingDate"
                                      placeholder="请选择" :disabled="judgeWrite('signingDate')" clearable
                                      :style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp"
                      >

                      </el-date-picker>
                    </el-form-item>
                  </el-col>

                  <el-col :span="6" v-if="judgeShow('purposeHouse')"
                  >
                    <el-form-item label="房屋用途"
                                  prop="purposeHouse"
                    >
                      <el-input v-model="dataForm.purposeHouse"
                                placeholder="请输入" :disabled="judgeWrite('purposeHouse')" clearable
                                :style='{"width":"100%"}'
                      >
                      </el-input>
                    </el-form-item>
                  </el-col>


                  <el-col :span="6" v-if="judgeShow('ihis')"
                  >
                    <el-form-item label="是否为历史合同"
                                  prop="ihis"
                    >
                      <el-switch v-model="dataForm.ihis"
                                 :disabled="judgeWrite('ihis')" :active-value="1" :inactive-value="0"
                      >

                      </el-switch>
                    </el-form-item>
                  </el-col>

                  <el-col :span="6" v-if="judgeShow('htFile')"
                  >
                    <el-form-item label="合同相关资料"
                                  prop="htFile">
                      <JNPF-UploadFz v-model="dataForm.htFile"
                                     :fileSize="10" :disabled="judgeWrite('htFile')" sizeUnit="MB" :limit="9"
                                     buttonText="上传附件">

                      </JNPF-UploadFz>
                    </el-form-item>
                  </el-col>

                  <el-col :span="6" v-if="judgeShow('notes')"
                  >
                    <el-form-item label="备注"
                                  prop="notes"
                    >
                      <el-input v-model="dataForm.notes"
                                placeholder="请输入" :disabled="judgeWrite('notes')" :style='{"width":"100%"}' true
                                type="textarea" :autosize='{"minRows":4,"maxRows":4}'
                      >

                      </el-input>
                    </el-form-item>
                  </el-col>


                  <el-col :span="24">
                    <el-card class="mb-20" shadow="always" header="甲方">
                      <el-col :span="9" v-if="judgeShow('partyName')"
                      >
                        <el-form-item label="甲方名称"
                                      prop="partyName"
                        >
                          <el-input v-model="dataForm.partyName"
                                    placeholder="请输入甲方名称" :disabled="judgeWrite('partyName')" clearable
                                    :style='{"width":"100%"}'
                          >

                          </el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :span="5" v-if="judgeShow('partyContacts')"
                      >
                        <el-form-item label="甲方联系人"
                                      prop="partyContacts"
                        >
                          <el-input v-model="dataForm.partyContacts"
                                    placeholder="请输入" :disabled="judgeWrite('partyContacts')" clearable
                                    :style='{"width":"100%"}'
                          >

                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="9" v-if="judgeShow('partyContactInformation')"
                      >
                        <el-form-item label="甲方联系方式"
                                      prop="partyContactInformation"
                        >
                          <el-input v-model="dataForm.partyContactInformation"
                                    placeholder="请输入" :disabled="judgeWrite('partyContactInformation')" clearable
                                    :style='{"width":"100%"}'
                          >

                          </el-input>
                        </el-form-item>
                      </el-col>
                    </el-card>
                  </el-col>
                  <el-col :span="24">
                    <el-card class="mb-20" shadow="always" header="乙方客户信息">
<!--                      <el-col :span="24" v-if="judgeShow('zcglhtglpabList') && formOperates">-->
                      <el-col :span="24">
                        <el-form-item label-width="0">
                          <div class="JNPF-common-title">
                            <h2></h2>
                          </div>
                          <el-table :data="dataForm.zcgl_htgl_pab" size="mini">
                            <el-table-column type="index" width="70" label="序号" align="center"/>
                            <el-table-column prop="pabCustomerName" label="乙方客户名称" width="180" align="center"
                                             v-if="judgeShow('zcglhtglpabList-pabCustomerName')"
                            >

                              <template slot-scope="scope">
                              <span>{{scope.row.pabCustomerName}}</span>

                              </template>
                              <template slot-scope="scope">
                                <el-form-item :prop="'zcgl_htgl_pab.' + scope.$index + '.pabCustomerName'"
                                >
                                  <el-select v-model="scope.row.pabCustomerName" placeholder="请选择"
                                             :disabled="judgeWrite('zcglhtglpabList') || judgeWrite('zcglhtglpabList-pabCustomerName')"
                                             clearable :style='{"width":"100%"}'
                                             @change="handleCustomerNameChange(scope.$index, scope.row)"
                                  >
                                    <el-option v-for="(item, index) in kfList" :key="index" :label="item.customerName"
                                               :value="item.id" :disabled="item.disabled"
                                    >
                                    </el-option>
                                  </el-select>
                                </el-form-item>
                              </template>
                            </el-table-column>
                            <el-table-column prop="pabContacts" label="乙方联系人"
                                             v-if="judgeShow('zcglhtglpabList-pabContacts')"
                            >

                              <template slot-scope="scope">
                                <el-form-item :prop="'zcgl_htgl_pab.' + scope.$index + '.pabContacts'"
                                >
                                  <el-input v-model="scope.row.pabContacts"
                                            placeholder="请输入"
                                            :disabled="judgeWrite('zcglhtglpabList') || judgeWrite('zcglhtglpabList-pabContacts')"
                                            clearable :style='{"width":"100%"}'
                                  >
                                  </el-input>
                                </el-form-item>
                              </template>
                            </el-table-column>

                            <el-table-column prop="pabContactNumber" label="乙方联系电话"
                                             v-if="judgeShow('zcglhtglpabList-pabContactNumber')"
                            >

                              <template slot-scope="scope">
                                <el-form-item :prop="'zcgl_htgl_pab.' + scope.$index + '.pabContactNumber'"
                                >
                                  <el-input v-model="scope.row.pabContactNumber"
                                            placeholder="请输入"
                                            :disabled="judgeWrite('zcglhtglpabList') || judgeWrite('zcglhtglpabList-pabContactNumber')"
                                            clearable :style='{"width":"100%"}'
                                  >
                                  </el-input>
                                </el-form-item>
                              </template>
                            </el-table-column>

                            <el-table-column prop="pabIdType" label="乙方证件类型"
                                             v-if="judgeShow('zcglhtglpabList-pabIdType')"
                            >

                              <template slot-scope="scope">
                                <el-form-item :prop="'zcgl_htgl_pab.' + scope.$index + '.pabIdType'"
                                >
                                  <el-input v-model="scope.row.pabIdType"
                                            placeholder="请输入"
                                            :disabled="judgeWrite('zcglhtglpabList') || judgeWrite('zcglhtglpabList-pabIdType')"
                                            clearable :style='{"width":"100%"}'
                                  >
                                  </el-input>
                                </el-form-item>
                              </template>
                            </el-table-column>

                            <el-table-column prop="pabIdNo" label="乙方证件号码"
                                             v-if="judgeShow('zcglhtglpabList-pabIdNo')"
                            >

                              <template slot-scope="scope">
                                <el-form-item :prop="'zcgl_htgl_pab.' + scope.$index + '.pabIdNo'"
                                >
                                  <el-input v-model="scope.row.pabIdNo"
                                            placeholder="请输入"
                                            :disabled="judgeWrite('zcglhtglpabList') || judgeWrite('zcglhtglpabList-pabIdNo')"
                                            clearable :style='{"width":"100%"}'
                                  >
                                  </el-input>
                                </el-form-item>
                              </template>
                            </el-table-column>

                            <el-table-column prop="pabContactAddress" label="乙方联系地址"
                                             v-if="judgeShow('zcglhtglpabList-pabContactAddress')"
                            >
                              <template slot="header" v-if="judgeRequired('zcglhtglpabList-pabContactAddress')">
                                <span class="required-sign">*</span>乙方联系地址
                              </template>
                              <template slot-scope="scope">
                                <el-input v-model="scope.row.pabContactAddress"
                                          placeholder="请输入"
                                          :disabled="judgeWrite('zcglhtglpabList') || judgeWrite('zcglhtglpabList-pabContactAddress')"
                                          clearable :style='{"width":"100%"}'
                                >
                                </el-input>
                              </template>
                            </el-table-column>
                            <el-table-column label="操作" width="70"
                                             v-if="!setting.readonly && !judgeWrite('zcglhtglpabList')"
                            >
                              <template slot-scope="scope">
                                <el-button size="mini" type="text" class="JNPF-table-delBtn"
                                           @click="delzcglhtglpabList(scope.$index)"
                                >删除
                                </el-button>
                              </template>
                            </el-table-column>
                          </el-table>
                          <div class="table-actions" @click="addzcglhtglpabList()">
                            <el-button type="text" icon="el-icon-plus">添加</el-button>
                          </div>
                        </el-form-item>
                      </el-col>
                    </el-card>
                  </el-col>
                </div>
                <div v-if="active == 1">

                  <el-col :span="8" v-if="judgeShow('contractType')"
                  >

                    <el-form-item label="合同类型"
                                  prop="htType"
                    >
                      <el-select v-model="dataForm.contractType"
                                 @change="changeType"
                                 placeholder="请选择" :disabled="judgeWrite('contractType')" clearable
                                 :style='{"width":"100%"}'
                      >
                        <el-option v-for="(item, index) in htTypeOptions" :key="index" :label="item.fullName"
                                   :value="item.fullName" :disabled="item.disabled"
                        ></el-option>

                      </el-select>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('startTime') "
                  >
                    <el-form-item label="合同起始日期"
                                  prop="startTime"
                    >
                      <el-date-picker v-model="dataForm.startTime"
                                      @change="check(dataForm)"
                                      placeholder="请选择" :disabled="judgeWrite('startTime')" clearable
                                      :style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp"
                      >

                      </el-date-picker>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('endTime') && dataForm.contractType!='无固定期限'"
                  >
                    <el-form-item label="合同结束日期"
                                  prop="endTime"
                    >
                      <el-date-picker v-model="dataForm.endTime"
                                      @change="check(dataForm)"
                                      placeholder="请选择" :disabled="judgeWrite('endTime')" clearable
                                      :style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp"
                      >

                      </el-date-picker>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('contractPeriod')"
                  >
                    <el-form-item label="合同期限"
                                  prop="contractPeriod"
                    >
                      <el-input v-model="dataForm.contractPeriod"
                                placeholder="请输入" :disabled="judgeWrite('contractPeriod')" clearable
                                :style='{"width":"100%"}'
                      >

                      </el-input>
                    </el-form-item>
                  </el-col>

                  <el-col :span="8" v-if="judgeShow('advancePaymentDays')">
                    <el-form-item label="提前缴费天数" prop="advancePaymentDays">
                      <el-input-number
                        v-model="dataForm.advancePaymentDays"
                        placeholder="请输入"
                        :disabled="judgeWrite('advancePaymentDays')"
                        :style='{"width":"100%"}'
                        clearable
                        :min="0"
                        :max="10000"
                      />
                    </el-form-item>
                  </el-col>

                  <el-col :span="24">
                    <el-card class="mb-20" shadow="always" header="租赁资产">
<!--                      <el-col :span="24" v-if="judgeShow('zcglhtglpabspaceList') && formOperates">-->
                      <el-col :span="24" >
                        <el-form-item label-width="0">
                          <div class="JNPF-common-title">
                            <h2></h2>
                          </div>
                          <el-table :data="dataForm.zcgl_htgl_pab_space1" size="mini">
                            <el-table-column type="index" width="70" label="序号" align="center"/>
                            <el-table-column prop="zcname" label="资产名称"
                                             v-if="judgeShow('zcglhtglpabspaceList-spaceName')"
                            >
                              <template slot="header" v-if="judgeRequired('zcglhtglpabspaceList-spaceName')">
                                <span class="required-sign">*</span>资产名称
                              </template>
                              <template slot-scope="scope">
                                <el-input v-model="scope.row.zcname"
                                          placeholder="请输入"
                                          :disabled="judgeWrite('zcglhtglpabspaceList') || judgeWrite('zcglhtglpabspaceList-spaceName')"
                                          clearable :style='{"width":"100%"}'
                                >
                                </el-input>
                              </template>
                            </el-table-column>
                            <el-table-column v-if="judgeShow('zcglhtglpabspaceList-operatingArea')" label="资产编码"
                                             prop="zcnumber"
                            >
                              <template v-if="judgeRequired('zcglhtglpabspaceList-operatingArea')" slot="header">
                                <span class="required-sign">*</span>资产编码
                              </template>
                              <template slot-scope="scope">
                                <el-input v-model="scope.row.zcnumber"
                                          :disabled="judgeWrite('zcglhtglpabspaceList') || judgeWrite('zcglhtglpabspaceList-operatingArea')"
                                          :style='{"width":"100%"}'
                                          clearable placeholder=""
                                >
                                </el-input>
                              </template>
                            </el-table-column>
                            <!--                        <el-table-column prop="address" label="资产地址"-->
                            <!--                                         v-if="judgeShow('zcglhtglpabspaceList-spaceType')"-->
                            <!--                        >-->
                            <!--                          <template slot="header" v-if="judgeRequired('zcglhtglpabspaceList-spaceType')">-->
                            <!--                            <span class="required-sign">*</span>资产地址-->
                            <!--                          </template>-->
                            <!--                          <template slot-scope="scope">-->
                            <!--                            <el-input v-model="scope.row.address"-->
                            <!--                                      placeholder="请输入"-->
                            <!--                                      :disabled="judgeWrite('zcglhtglpabspaceList') || judgeWrite('zcglhtglpabspaceList-spaceType')"-->
                            <!--                                      clearable :style='{"width":"100%"}'-->
                            <!--                            >-->
                            <!--                            </el-input>-->
                            <!--                          </template>-->
                            <!--                        </el-table-column>-->

                            <!--                        <el-table-column prop="buildingmeasurementarea" label="建筑测量面积"-->
                            <!--                                         v-if="judgeShow('zcglhtglpabspaceList-buildingmeasurementarea')"-->
                            <!--                        >-->
                            <!--                          <template slot="header" v-if="judgeRequired('zcglhtglpabspaceList-buildingmeasurementarea')">-->
                            <!--                            <span class="required-sign">*</span>建筑测量面积-->
                            <!--                          </template>-->
                            <!--                          <template slot-scope="scope">-->
                            <!--                            <el-input v-model="scope.row.zcgl_zcdj_area.buildingmeasurementarea"-->
                            <!--                                      placeholder="请输入"-->
                            <!--                                      :disabled="judgeWrite('zcglhtglpabspaceList') || judgeWrite('zcglhtglpabspaceList-buildingmeasurementarea')"-->
                            <!--                                      clearable :style='{"width":"100%"}'-->
                            <!--                            >-->
                            <!--                            </el-input>-->
                            <!--                          </template>-->
                            <!--                        </el-table-column>-->

                            <el-table-column label="操作" width="50"
                                             v-if="!setting.readonly && !judgeWrite('zcglhtglpabspaceList')"
                            >
                              <template slot-scope="scope">
                                <el-button size="mini" type="text" class="JNPF-table-delBtn"
                                           @click="delzcglhtglpabspaceList(scope.$index)"
                                >删除
                                </el-button>
                              </template>
                            </el-table-column>
                          </el-table>
                          <div class="table-actions" @click="addzcglhtglpabspaceList()">
                            <!--                          <el-button type="text" icon="el-icon-plus">添加</el-button>-->
                            <Popup v-model="dataForm.lastmodifytime"
                                   @addList="handleAddList"
                                   placeholder="请选择" clearable field="assetName" interfaceId="612769091110831365"
                                   :columnOptions="lastmodifytimecolumnOptions" propsValue="id" relationField="zcname"
                                   popupType="dialog"
                                   popupTitle="选择资产" popupWidth="800px"
                                   hasPage :pageSize="20"
                            >
                            </Popup>
                          </div>
                        </el-form-item>
                      </el-col>
                    </el-card>
                  </el-col>
                  <el-col :span="24">
                    <el-card class="mb-20" shadow="always" header="租金费用条款">

                      <el-row v-for="(item, index) in dataForm.zcgl_htgl_pab_fytk" :key="index">
                        <el-row>

                          <el-col :span="8" v-if="judgeShow('jnpf_zcgl_htgl_pab_fytk_jnpf_startTime')"
                          >
                            <el-form-item label="关联资产"
                                          :prop="getItemProp_zcgl_htgl_pab_fytk(index, 'relatedSpace')"
                                          v-show="false"
                            >
                              <!--                            :disabled="judgeWrite('relatedSpace')"-->
                              <el-select multiple v-model="item.relatedSpace"
                                         clearable
                                         :style='{"width":"100%"}'
                                         @change="toGetArea(item)"
                              >
                                <el-option v-for="(item, index) in dataForm.zcgl_htgl_pab_space1" :key="index"
                                           :label="item.zcname"
                                           :value="item.id" :disabled="item.disabled"
                                ></el-option>

                              </el-select>
                            </el-form-item>
                          </el-col>

                          <el-col :span="8" v-if="judgeShow('rentalArea')"
                          >
                            <el-form-item label="租赁面积㎡"
                                          prop="rentalArea"
                            >
                              <el-input v-model="item.rentalArea"
                                        placeholder="请输入" :disabled="judgeWrite('rentalArea')"
                                        clearable :style='{"width":"80%"}'
                              >
                              </el-input>
                            </el-form-item>
                          </el-col>

                          <el-col :span="8" v-if="judgeShow('jnpf_zcgl_htgl_pab_fytk_jnpf_startTime')"
                          >
                            <el-form-item
                              :prop="getItemProp_zcgl_htgl_pab_fytk(index, 'rentMethod')"
                              label="计租方式"
                            >
                              <!--                            :disabled="judgeWrite('relatedSpace')"-->
                              <el-select
                                v-model="item.rentMethod"
                                clearable
                                clearable :style='{"width":"80%"}'
                              >
                                <el-option
                                  label="固定租金"
                                  value="固定租金"
                                ></el-option>
                              </el-select>
                            </el-form-item>
                          </el-col>

                          <el-col :span="8" v-if="judgeShow('jnpf_zcgl_htgl_pab_fytk_jnpf_startTime')"
                          >
                            <el-form-item label="费用项"
                                          :prop="getItemProp_zcgl_htgl_pab_fytk(index, 'expenseType')"
                            >
                              <!--                            :disabled="judgeWrite('relatedSpace')"-->
                              <el-select

                                v-model="item.expenseType"
                                clearable
                                clearable :style='{"width":"80%"}'
                              >
                                <el-option
                                  label="房屋租金"
                                  value="1"
                                ></el-option>
                                <el-option
                                  label="物业"
                                  value="2"
                                ></el-option>
                                <el-option
                                  label="其他费用"
                                  value="3"
                                ></el-option>
                              </el-select>
                            </el-form-item>
                          </el-col>
                        </el-row>

                        <el-row>

                          <el-col :span="8" v-if="judgeShow('jnpf_zcgl_htgl_pab_fytk_jnpf_taxRate')">
                            <el-form-item label="税率(%)" prop="jnpf_zcgl_htgl_pab_fytk_jnpf_taxRate">
                              <el-input-number
                                v-model="item.taxRate"
                                placeholder="数字文本"
                                :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_taxRate')"
                                :step="0.01"
                                :precision="2"
                              />
                            </el-form-item>
                          </el-col>

                          <el-col :span="8" v-if="judgeShow('jnpf_zcgl_htgl_pab_fytk_jnpf_hsUnit')"
                          >
                            <el-form-item label="含税租金单价(元)"
                                          prop="hsUnitPrice"
                            >
                              <el-input-number v-model="item.hsUnitPrice"
                                               placeholder="数字文本"
                                               :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_hsUnit')"
                                               :step="0.01"
                                               :precision="2"
                              >
                              </el-input-number>
                            </el-form-item>
                          </el-col>

                          <el-col :span="8" v-if="judgeShow('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"
                          >
                            <el-form-item label="不含税租金单价(元)"
                                          prop="bhsUnitPrice"
                            >
                              <el-input-number v-model="item.bhsUnitPrice"
                                               placeholder="数字文本"
                                               :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"
                                               :step="0.01"
                                               :precision="2"
                              >
                              </el-input-number>
                            </el-form-item>
                          </el-col>


                        </el-row>

                        <el-row>
                          <el-col :span="8"
                          >
                            <el-form-item label="月租金(元)"
                                          :prop="getItemProp_zcgl_htgl_pab_fytk(index, 'monthlyRent')"
                            >
                              <el-input-number v-model="item.monthlyRent"
                                               placeholder="数字文本"
                                               :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"
                                               :step="0.01"
                                               :precision="2"
                              >
                              </el-input-number>
                            </el-form-item>
                          </el-col>

                          <el-col :span="8"
                          >
                            <el-form-item label="保证金(元)"
                                          :prop="getItemProp_zcgl_htgl_pab_fytk(index, 'jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"
                            >
                              <el-input-number v-model="item.earnestMoney"
                                               placeholder="数字文本"
                                               :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"
                                               :step="0.01"
                                               :precision="2"
                              >
                              </el-input-number>
                            </el-form-item>
                          </el-col>

                          <el-col :span="8"
                          >
                            <el-form-item label="违约金(元)"
                                          :prop="getItemProp_zcgl_htgl_pab_fytk(index, 'jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"
                            >
                              <el-input-number v-model="item.defaultMoney"
                                               placeholder="数字文本"
                                               :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"
                                               :step="0.01"
                                               :precision="2"
                              >
                              </el-input-number>
                            </el-form-item>
                          </el-col>

                          <el-col style="display: flex" :span="8"
                                  v-if="judgeShow('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"
                          >
                            <el-form-item label="付款周期(月)"
                                          placeholder="数字文本"
                                          :prop="getItemProp_zcgl_htgl_pab_fytk(index, 'paymentCycle')"

                            >
                              <el-input-number v-model="item.paymentCycle"
                                               :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"
                                               :step="1"
                              >
                              </el-input-number>
                            </el-form-item>
                          </el-col>
                          <el-col :span="8">

                            <el-form-item label="培育期"
                                          prop="ihis"
                            >
                              <el-switch
                                @change="changeTypeItem(index,item)"

                                v-model="item.isAvailable"
                                :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')" :active-value="1"
                                :inactive-value="0"
                              >

                              </el-switch>
                            </el-form-item>
                          </el-col>
                          <el-col :span="8">

                            <el-form-item v-if="item.isAvailable==1" label="优惠月数"
                                          prop="ihis"
                                          :prop="getItemProp_zcgl_htgl_pab_fytk(index, 'availableMonth')"
                            >
                              <el-input-number v-model="item.availableMonth"
                                               :step="1"
                              >
                              </el-input-number>
                            </el-form-item>
                          </el-col>
                        </el-row>
                        <el-row>
                          <el-col :span="8">

                            <el-form-item label="是否递增"
                                          prop="ihis"
                            >
                              <el-switch v-model="item.isIncreasing"
                                         :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')" :active-value="1"
                                         :inactive-value="0"
                              >

                              </el-switch>
                            </el-form-item>
                          </el-col>

                          <el-col :span="8">
                            &nbsp;
                          </el-col>
                          <el-col :span="8">
                            <el-form-item>

                              <el-button style="margin-left: 60%" type="danger" @click.prevent="removeFytk(index)">删除</el-button>
                            </el-form-item>
                          </el-col>
                        </el-row>

                        <!--递增条款-->
                        <el-row>
                          <el-table
                            v-if="item.isIncreasing==1"
                            :data="item.listDz"
                            style="width: 100%"
                            border
                          >
                            <el-table-column
                              prop="start"
                              label="开始日期"
                            />
                            <el-table-column
                              prop="end"
                              label="结束日期"
                            />
                            <el-table-column
                              prop="rent"
                              label="租金单价"
                            />
                            <!--                        <el-table-column-->
                            <!--                          prop="paymentDate"-->
                            <!--                          label="付款日期"-->
                            <!--                          width="250"-->
                            <!--                        />-->
                            <el-table-column
                              v-if="dzForm.dzType=='百分比'"
                              prop="increasePercent"
                              label="递增(百分比)"
                            />

                            <el-table-column
                              v-if="dzForm.dzType=='固定金额'"
                              prop="increasePercent"
                              label="递增(元)"
                            />

                          </el-table>
                          <div v-if="item.isIncreasing==1" class="table-actions" @click="addzcglhtglpabspaceList()">
                            <el-button type="text" icon="el-icon-plus" @click="addDz(item)">批量新增递增条款</el-button>
                          </div>
                        </el-row>

                        <el-row>


                        </el-row>


                        <el-divider v-if="index < dataForm.zcgl_htgl_pab_fytk.length - 1"></el-divider>

                      </el-row>
                      <el-row>

                        <div class="table-actions" @click="addzcglhtglpabspaceList()">
                          <el-button type="text" icon="el-icon-plus" @click="addFytk">添加费用</el-button>
                        </div>

                      </el-row>
                    </el-card>
                  </el-col>


                  <!--              <el-col :span="24">-->
                  <!--                <el-card class="mb-20" shadow="always" header="其他费用条款">-->

                  <!--                  <el-row v-for="(item, index) in dataForm.zcgl_htgl_pab_qtfytk" :key="index">-->

                  <!--                      <el-col :span="8"-->
                  <!--                      >-->
                  <!--                        <el-form-item label="费用项"-->
                  <!--                                      :prop="getItemProp_zcgl_htgl_pab_qtfytk(index, 'expenseType')"-->

                  <!--                        >-->
                  <!--                          <el-select-->

                  <!--                            v-model="item.expenseType"-->
                  <!--                            clearable-->
                  <!--                            clearable :style='{"width":"80%"}'-->
                  <!--                          >-->
                  <!--                            <el-option-->
                  <!--                              label="房屋租金"-->
                  <!--                              value="1"-->
                  <!--                            ></el-option>-->
                  <!--                            <el-option-->
                  <!--                              label="物业"-->
                  <!--                              value="2"-->
                  <!--                            ></el-option>-->
                  <!--                          </el-select>-->
                  <!--                        </el-form-item>-->
                  <!--                      </el-col>-->

                  <!--                      <el-col :span="8"-->
                  <!--                      >-->
                  <!--                        <el-form-item label="起始日期"-->
                  <!--                                      prop="startTime"-->
                  <!--                        >-->
                  <!--                          <el-date-picker v-model="item.startTime"-->
                  <!--                                          @change="check(item)"-->
                  <!--                                          placeholder="请选择" clearable-->
                  <!--                                          :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"-->
                  <!--                          >-->

                  <!--                          </el-date-picker>-->
                  <!--&lt;!&ndash;                          :disabled="judgeWrite('startTime')"&ndash;&gt;-->
                  <!--&lt;!&ndash;                          :disabled="judgeWrite('endTime')"&ndash;&gt;-->
                  <!--                        </el-form-item>-->
                  <!--                      </el-col>-->

                  <!--                      <el-col :span="8"-->
                  <!--                      >-->
                  <!--                        <el-form-item label="结束日期"-->
                  <!--                                      :prop="getItemProp_zcgl_htgl_pab_qtfytk(index, 'endTime')"-->
                  <!--                        >-->
                  <!--                          <el-date-picker v-model="item.endTime"-->
                  <!--                                          @change="check(item)"-->
                  <!--                                          placeholder="请选择"  clearable-->
                  <!--                                          :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"-->
                  <!--                          >-->

                  <!--                          </el-date-picker>-->
                  <!--                        </el-form-item>-->
                  <!--                      </el-col>-->
                  <!--                        <el-col :span="8"-->
                  <!--                        >-->
                  <!--                          <el-form-item label="月租金(元)"-->
                  <!--                                        :prop="getItemProp_zcgl_htgl_pab_qtfytk(index, 'money')"-->
                  <!--                          >-->
                  <!--                            <el-input-number v-model="item.money"-->
                  <!--                                             placeholder="数字文本"-->
                  <!--                                             :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"-->
                  <!--                                             :step="0.01"-->
                  <!--                                             :precision="2"-->
                  <!--                            >-->
                  <!--                            </el-input-number>-->
                  <!--                          </el-form-item>-->
                  <!--                        </el-col>-->


                  <!--                        <el-col style="display: flex" :span="8"-->
                  <!--                                v-if="judgeShow('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"-->
                  <!--                        >-->
                  <!--                          <el-form-item label="付款周期(月)"-->
                  <!--                                        placeholder="数字文本"-->
                  <!--                                        :prop="getItemProp_zcgl_htgl_pab_qtfytk(index, 'paymentCycle')"-->

                  <!--                          >-->
                  <!--                            <el-input-number v-model="item.paymentCycle"-->
                  <!--                                             :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"-->
                  <!--                                             :step="1"-->
                  <!--                            >-->
                  <!--                            </el-input-number>-->
                  <!--                          </el-form-item>-->
                  <!--                        </el-col>-->
                  <!--                        <el-col :span="8">-->
                  <!--                          <el-form-item>-->
                  <!--                            <el-button  style="margin-left: 60%" type="danger" @click.prevent="removeFyQttk(index)">删除</el-button>-->
                  <!--                          </el-form-item>-->
                  <!--                        </el-col>-->


                  <!--                      <el-divider v-if="index < dataForm.zcgl_htgl_pab_qtfytk.length - 1"></el-divider>-->

                  <!--&lt;!&ndash;                    <el-row>加了这个不得行&ndash;&gt;-->


                  <!--&lt;!&ndash;                    </el-row>&ndash;&gt;-->


                  <!--                  </el-row>-->
                  <!--                  <div class="table-actions" @click="addzcglhtglpabspaceList()">-->
                  <!--                    <el-button type="text" icon="el-icon-plus" @click="addFyQtTk">添加其他费用</el-button>-->
                  <!--                  </div>-->
                  <!--                </el-card>-->
                  <!--              </el-col>-->


                </div>

                <div v-if="active==2">
                  <el-card class="mb-20" header="乙方" shadow="always">
                    <el-col v-if="judgeShow('zcglhtglpabList')" :span="24">
                      <el-form-item label-width="0">
                        <div class="JNPF-common-title">
                          <h2></h2>
                        </div>
<!--                        :span-method="objectSpanMethod"-->

                        <div v-for="(item, index) in skjh" :key="index">
                          <el-table
                            :data="item.listSk"
                            border
                            style="width: 100%"
                          >
<!--                            <el-table-column-->
<!--                              fixed-->
<!--                              label="资产名称"-->
<!--                              prop="relatedSpace"-->
<!--                              width="250"-->
<!--                            />-->
                            <el-table-column
                              label="费用项"
                              prop="expenseItem"
                              width="222"
                            />


                            <el-table-column
                              label="周期"
                              prop="intervall"
                              width="222"
                            />
                            <el-table-column
                              label="付款日期"
                              prop="paymentDate"
                              width="222"
                            />

                            <el-table-column
                              label="月租金"
                              prop="monthlyRent"
                              width="155"
                            />
                            <el-table-column
                              label="应收金额"
                              prop="inclusiveAmount"
                              width="155"
                            />
<!--                            <el-table-column-->
<!--                              label="不含税金额"-->
<!--                              prop="excludingAmount"-->
<!--                              width="222"-->
<!--                            />-->
<!--                            <el-table-column-->
<!--                              label="税率"-->
<!--                              prop="taxRate"-->
<!--                              width="80"-->
<!--                            />-->
                          </el-table>
                        </div>

                      </el-form-item>
                    </el-col>
                  </el-card>

                </div>
                <div v-if="active==3">
                  <el-card class="mb-20" header="收款账户" shadow="always">
                    <el-col v-if="judgeShow('zcglhtglpabList')" :span="24">
                      <el-form-item label-width="0">
                        <div class="JNPF-common-title">
                          <h2></h2>
                        </div>
                        <el-table :data="dataForm.zcgl_htgl_qtskzhs" size="mini">
                          <el-table-column align="center" label="序号" type="index" width="80"/>

                          <el-table-column v-if="judgeShow('zcglhtglpabList-pabContactNumber')" label="费用项"
                                           prop="pabContactNumber"
                          >
                            <template v-if="judgeRequired('zcglhtglpabList-pabContactNumber')" slot="header">
                              <span class="required-sign">*</span>费用项
                            </template>
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.expenseItem"
                                        :disabled="judgeWrite('zcglhtglpabList') || judgeWrite('zcglhtglpabList-pabContactNumber')"
                                        :style='{"width":"100%"}'
                                        clearable placeholder=""
                              >
                              </el-input>
                            </template>
                          </el-table-column>


                          <el-table-column v-if="judgeShow('zcglhtglpabList-pabIdNo')" label="户名" prop="pabIdNo"
                          >
                            <template v-if="judgeRequired('zcglhtglpabList-pabIdNo')" slot="header">
                              <span class="required-sign">*</span>户名
                            </template>
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.accountName"
                                        :disabled="judgeWrite('zcglhtglpabList') || judgeWrite('zcglhtglpabList-pabIdNo')"
                                        :style='{"width":"100%"}'
                                        clearable placeholder=""
                              >
                              </el-input>
                            </template>
                          </el-table-column>

                          <el-table-column v-if="judgeShow('zcglhtglpabList-pabContactAddress')" label="开户银行"
                                           prop="pabContactAddress"
                          >
                            <template v-if="judgeRequired('zcglhtglpabList-pabContactAddress')" slot="header">
                              <span class="required-sign">*</span>开户银行
                            </template>
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.bankDeposit"
                                        :disabled="judgeWrite('zcglhtglpabList') || judgeWrite('zcglhtglpabList-pabContactAddress')"
                                        :style='{"width":"100%"}'
                                        clearable placeholder=""
                              >
                              </el-input>
                            </template>
                          </el-table-column>
                          <el-table-column v-if="judgeShow('zcglhtglpabList-pabIdNo')" label="账号" prop="pabIdNo"
                          >
                            <template v-if="judgeRequired('zcglhtglpabList-pabIdNo')" slot="header">
                              <span class="required-sign">*</span>账号
                            </template>
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.accountNumber"
                                        :disabled="judgeWrite('zcglhtglpabList') || judgeWrite('zcglhtglpabList-pabIdNo')"
                                        :style='{"width":"100%"}'
                                        clearable placeholder=""
                              >
                              </el-input>
                            </template>
                          </el-table-column>
                          <el-table-column v-if="!setting.readonly && !judgeWrite('zcglhtglpabList')" label="操作"
                                           width="60"
                          >
                            <template slot-scope="scope">
                              <el-button class="JNPF-table-delBtn" size="mini" type="text"
                                         @click="delzcglhtglpabList(scope.$index)"
                              >删除
                              </el-button>
                            </template>
                          </el-table-column>
                        </el-table>
                        <div class="table-actions" @click="addzcgl_htgl_qtskzhList()">
                          <el-button icon="el-icon-plus" type="text">添加</el-button>
                        </div>
                      </el-form-item>
                    </el-col>
                  </el-card>


                  <el-card class="mb-20" header="其他条款" shadow="always">
                    <el-col v-if="judgeShow('zcglhtglpabList')" :span="24">
                      <el-form-item label-width="0">
                        <div class="JNPF-common-title">
                          <h2></h2>
                        </div>
                        <el-table :data="dataForm.zcgl_htgl_qtydtks" size="mini">
                          <el-table-column align="center" label="序号" type="index" width="80"/>

                          <el-table-column v-if="judgeShow('zcglhtglpabList-pabContactNumber')" label="条款"
                                           prop="pabContactNumber"
                          >
                            <template v-if="judgeRequired('zcglhtglpabList-pabContactNumber')" slot="header">
                              <span class="required-sign">*</span>条款
                            </template>
                            <template slot-scope="scope">
                              <el-input v-model="scope.row.clauseContent"
                                        :disabled="judgeWrite('zcglhtglpabList') || judgeWrite('zcglhtglpabList-pabContactNumber')"
                                        :style='{"width":"100%"}'
                                        clearable
                                        placeholder="" type="textarea"
                              >
                              </el-input>
                            </template>
                          </el-table-column>


                          <el-table-column v-if="!setting.readonly && !judgeWrite('zcglhtglpabList')" label="操作"
                                           width="60"
                          >
                            <template slot-scope="scope">
                              <el-button class="JNPF-table-delBtn" size="mini" type="text"
                                         @click="delzcglhtglpabList(scope.$index)"
                              >删除
                              </el-button>
                            </template>
                          </el-table-column>
                        </el-table>
                        <div class="table-actions" @click="addzcgl_htgl_qtydtkList()">
                          <el-button icon="el-icon-plus" type="text">添加</el-button>
                        </div>
                      </el-form-item>
                    </el-col>
                  </el-card>
                </div>

              </el-col>
            </template>
          </el-form>
        </el-row>
        <UserBox v-if="userBoxVisible" ref="userBox" @submit="submit"/>

        <el-dialog :modal-append-to-body="false"
                   :visible.sync="dzDialog" append-to-body class="JNPF-dialog JNPF-dialog_center transfer-dialog"
                   lock-scroll
                   title="新建递增计划"
                   width="400px" @close="onClose"
        >
          <el-form ref="elForm" :model="dzForm" class="custom-form" label-width="120px" size="medium">
            <el-form-item class="form-item" label="递增开始时间">
              <el-date-picker
                v-model="dzForm.startTime"
                clearable
                format="yyyy-MM-dd"
                placeholder="请选择"
                style="width: 100%;"
                value-format="timestamp"
              >
              </el-date-picker>
            </el-form-item>

            <el-form-item class="form-item" label="每月递增">
              <el-input
                v-model="dzForm.dz"
                :disabled="judgeWrite('jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit')"
                clearable
                placeholder="请输入百分比"
                style="width: 100%;"
              >
              </el-input>
            </el-form-item>

            <el-form-item class="form-item">
              <el-button type="primary" @click="submitDz">确定</el-button>
            </el-form-item>
          </el-form>

        </el-dialog>

        <Preview :visible.sync="previewVisible" :id="activeId"  :htId="htId"/>
        <!--        <div class="fixed-bottom">-->
        <!--          <button v-if="active!=0" class="confirm-button" @click="nextS">上一页</button>-->
        <!--          <button v-if="(active!=3 && active!=1) || (setting.readonly && active!=3) " class="confirm-button"-->
        <!--                  @click="next">下一页-->
        <!--          </button>-->
        <!--          <button v-if="active == 1 && !setting.readonly" class="confirm-button" @click="createSk">生成收款计划</button>-->

        <!--        </div>-->
      </div>
    </div>
  </transition>
</template>
<script>
import request from '@/utils/request'
import {getDataInterfaceRes} from '@/api/systemData/dataInterface'
import {getDictionaryDataSelector} from '@/api/systemData/dictionary'
import Popup from './PopupSelect'
import PrintBrowse from '@/components/PrintBrowse'
import ElTreeSelect from '@/components/JNPF-treeSelect'
import Preview from '../../system/printDev/Preview'
export default {
  components: {ElTreeSelect, Popup,Preview},
  props: [],
  data() {
    return {
      activeId:"",
      htId:"",
      active: 0,
      dzItem: {},
      dzForm: {},
      dzDialog: false,
      spanArr: [], // 用于合并单元格的数组
      position: 0, // 用于记录位置
      skjh: [],
      lastmodifytimecolumnOptions: [
        {
          value: 'fid',
          label: 'ID'
        },
        {
          value: 'zcname',
          label: '资产名称'
        }
        , {
          value: 'zclabel',
          label: '资产标签'
        }
        ,
        {
          value: 'zcnumber',
          label: '资产编码'
        },

        {
          value: 'address',
          label: '地址'
        },
        {
          value: 'landarea',
          label: '面积'
        }
      ],

      kfList: [],
      visible: false,
      loading: false,
      setting: {},
      eventType: '',
      userBoxVisible: false,
      currTableConf: {},
      addTableConf: {
        zcglhtglpabspaceList: {
          'popupType': 'dialog',
          'hasPage': true,
          'popupTitle': '选择数据',
          'pageSize': 20,
          'columnOptions': [],
          'interfaceId': '',
          'interfaceName': '',
          'relationOptions': [],
          'templateJson': [],
          'popupWidth': '800px'
        }

      },
      tableRows: {
        zcglhtglpabList: {
          pabContactNumber: '',
          pabIdNo: '',
          pabContactAddress: '',
          enabledmark: undefined
        },
        zcglhtglpabspaceList: {
          spaceName: '',
          operatingArea: '',
          spaceType: '',
          rentalStatus: '',
          enabledmark: undefined
        }
      },
      dataForm: {
        id: '',
        flowId: '',
        status: 1,
        freeapproveruserid: '',
        flowUrgent: 1,
        contractNumber: undefined,
        contractType: undefined,
        project: undefined,
        relatedContracts: undefined,
        signingDate: undefined,
        effectiveDate: undefined,
        purposeHouse: undefined,
        contractHandler: undefined,
        ihis: 0,
        notes: undefined,
        partyName: undefined,
        partyBusinessLicense: undefined,
        partyContacts: undefined,
        partyContactInformation: undefined,
        startTime: undefined,
        endTime: undefined,
        paymentDeadlineType: undefined,
        paymentDeadline: undefined,
        paymentDeadlineStatus: undefined,
        paymentZdrq: undefined,
        zcgl_htgl_pab: [],
        zcgl_htgl_qtskzhs: [],
        zcgl_htgl_qtydtks: [],
        zcglhtglpabspaceList: [],
        zcgl_htgl_pab_fytk:
          [{
            startTime: '',
            endTime: '',
            taxRate: '',
            hsUnit: '',
            bhsUnit: '1',
            bhsUnitPrice: '',
            hsUnitPrice: ''
          }],
        jnpf_zcgl_htgl_pab_fytk_jnpf_startTime: '',
        jnpf_zcgl_htgl_pab_fytk_jnpf_endTime: '',
        jnpf_zcgl_htgl_pab_fytk_jnpf_taxRate: '',
        jnpf_zcgl_htgl_pab_fytk_jnpf_hsUnit: '',
        jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit: ''
      },
      tableRequiredData: {},
      activezizgbo: '0',
      dataRule:
        {
          // zcgl_htgl_pab_fytk: [
          //   {
          //     monthlyRent: [
          //       { required: true, message: '请输入月租金', trigger: 'blur' },
          //       {
          //         validator: (rule, value, callback) => {
          //           if (!value || value.trim() === '') {
          //             callback(new Error('月租金不能为空'));
          //           } else {
          //             callback();
          //           }
          //         },
          //         trigger: 'blur',
          //       },
          //     ],
          //   },
          //   ],
          'title': [{'required': true, 'message': '流程标题不能为空', 'trigger': 'blur'}],
          'contractNumber': [{'required': true, 'message': '合同编号不能为空', 'trigger': 'blur'}],
          'contractType': [{'required': true, 'message': '合同类型不能为空', 'trigger': 'blur'}],
          'signingDate': [{'required': true, 'message': '签订日期不能为空', 'trigger': 'blur'}],
          'effectiveDate': [{'required': true, 'message': '生效日期不能为空', 'trigger': 'blur'}],
          'partyName': [{'required': true, 'message': '甲方名称不能为空', 'trigger': 'blur'}],
          'partyContacts': [{'required': true, 'message': '甲方联系人不能为空', 'trigger': 'blur'}],
          'partyContactInformation': [{'required': true, 'message': '甲方联系方式不能为空', 'trigger': 'blur'}],
          'startTime': [{'required': true, 'message': '合同起始日期不能为空', 'trigger': 'blur'}],
          'endTime': [{'required': true, 'message': '合同结束日期不能为空', 'trigger': 'blur'}],
          'paymentDeadlineType': [{'required': true, 'message': '交费期限类型不能为空', 'trigger': 'blur'}],
          'paymentDeadline': [{'required': true, 'message': '交费期限日不能为空', 'trigger': 'blur'}],
          'jnpf_zcgl_htgl_pab_fytk_jnpf_startTime': [{'required': true, 'message': '租金开始日期不能为空', 'trigger': 'blur'}],
          'jnpf_zcgl_htgl_pab_fytk_jnpf_endTime': [{'required': true, 'message': '租金结束日期不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.0.relatedSpace': [{'required': true, 'message': '关联资产不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.1.relatedSpace': [{'required': true, 'message': '关联资产不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.2.relatedSpace': [{'required': true, 'message': '关联资产不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.3.relatedSpace': [{'required': true, 'message': '关联资产不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.0.monthlyRent': [{'required': true, 'message': '月租金不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.1.monthlyRent': [{'required': true, 'message': '月租金不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.2.monthlyRent': [{'required': true, 'message': '月租金不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.3.monthlyRent': [{'required': true, 'message': '月租金不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab.0.pabCustomerName': [{'required': true, 'message': '乙方客户名称0不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab.0.pabContactNumber': [{'required': true, 'message': '乙方客户电话0不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab.1.pabContactNumber': [{'required': true, 'message': '乙方客户电话1不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab.1.pabCustomerName': [{'required': true, 'message': '乙方客户名称1不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab.2.pabCustomerName': [{'required': true, 'message': '乙方客户名称2不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab.3.pabCustomerName': [{'required': true, 'message': '乙方客户名称3不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab.2.pabContactNumber': [{'required': true, 'message': '乙方客户电话2不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab.3.pabContactNumber': [{'required': true, 'message': '乙方客户电话3不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.0.rentMethod': [{'required': true, 'message': '费用类别0不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.1.rentMethod': [{'required': true, 'message': '费用类别1不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.2.rentMethod': [{'required': true, 'message': '费用类别2不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.3.rentMethod': [{'required': true, 'message': '费用类别3不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.0.expenseType': [{'required': true, 'message': '租金类别0不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.1.expenseType': [{'required': true, 'message': '租金类别1不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.2.expenseType': [{'required': true, 'message': '租金类别2不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.3.expenseType': [{'required': true, 'message': '租金类别3不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.0.startTime': [{'required': true, 'message': '开始日期1不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.1.startTime': [{'required': true, 'message': '开始日期2不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.2.startTime': [{'required': true, 'message': '开始日期3不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.3.startTime': [{'required': true, 'message': '开始日期4不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.0.endTime': [{'required': true, 'message': '结束日期1不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.1.endTime': [{'required': true, 'message': '结束日期2不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.2.endTime': [{'required': true, 'message': '结束日期3不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.3.endTime': [{'required': true, 'message': '结束日期4不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.0.cycleDivisionMethod': [{'required': true, 'message': '周期划分方式1不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.1.cycleDivisionMethod': [{'required': true, 'message': '周期划分方式2不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.2.cycleDivisionMethod': [{'required': true, 'message': '周期划分方式3不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.3.cycleDivisionMethod': [{'required': true, 'message': '周期划分方式4不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.0.paymentCycle': [{'required': true, 'message': '付款周期1不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.1.paymentCycle': [{'required': true, 'message': '付款周期2不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.2.paymentCycle': [{'required': true, 'message': '付款周期3不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.3.paymentCycle': [{'required': true, 'message': '付款周期4不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.0.paymentType': [{'required': true, 'message': '收款日1不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.1.paymentType': [{'required': true, 'message': '收款日2不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.2.paymentType': [{'required': true, 'message': '收款日3不能为空', 'trigger': 'blur'}],
          'zcgl_htgl_pab_fytk.3.paymentType': [{'required': true, 'message': '收款日4不能为空', 'trigger': 'blur'}]
        },
      contractTypeOptions: [],
      projectOptions: [],
      relatedContractsOptions: [{'fullName': '选项一', 'id': '1'}, {'fullName': '选项二', 'id': '2'}],
      partyNameOptions: [{'fullName': '选项一', 'id': '1'}, {'fullName': '选项二', 'id': '2'}],
      paymentDeadlineTypeOptions: [],
      paymentDeadlineStatusOptions: [],
      previewVisible: false,
      pabCustomerNameOptions: [{'fullName': '选项一', 'id': '1'}, {'fullName': '选项二', 'id': '2'}],
      pabIdTypeOptions: [{'fullName': '选项一', 'id': '1'}, {'fullName': '选项二', 'id': '2'}]
    }
  },
  computed: {
    formOperates() {
      return this.setting.formOperates
    }
  },
  watch: {},
  created() {
    this.getcontractTypeOptions()
    this.getprojectOptions()
    this.getpaymentDeadlineTypeOptions()
    this.getpaymentDeadlineStatusOptions()

    this.getKhList()

  },
  mounted() {
  },
  methods: {

    htPrint(id,htId){
      if (!id) return
      this.activeId = id
      this.htId = htId
      this.previewVisible = true
    },

    goBack() {
      this.$emit('close')
    },
    check(item) {
      if (new Date(item.endTime) > new Date(item.startTime)) {
        this.$message({
          message: '结束时间不能大于开始时间，请重新设置！',
          type: 'error',
          duration: 1000
        })
        // 不设置结束时间
        item.endTime = null;
        return
      }
    },
    toMethod(item) {
      if (item.cycleDivisionMethod == '1') {


        item.paymentCycle = 3
      }
    },

    getItemProp(index, prop) {
      // return `zcgl_htgl_pab[${index}].${prop}`
      return `zcgl_htgl_pab.${index}.${prop}`
    },
    getItemProp_zcgl_htgl_pab_fytk(index, prop) {
      // return `zcgl_htgl_pab[${index}].${prop}`
      return `zcgl_htgl_pab_fytk.${index}.${prop}`
    },
    nextS() {

      if (this.active-- < 1) this.active = 0
    },

    next() {

      if (this.active++ > 2) this.active = 3

      this.$forceUpdate()
      this.updateDataRule()
    },
    submitDz() {
      const contractStartTime = new Date(this.dzItem.startTime) // 合同开始时间
      const contractEndTime = new Date(this.dzItem.endTime) // 合同结束时间
      const paymentCycle = parseInt(this.dzItem.paymentCycle) // 付款周期，单位：月
      const paymentType = this.dzItem.paymentType // '账单开始前' 或 '账单开始后'
      const monthlyRent = parseFloat(this.dzItem.monthlyRent) // 月租金
      const paymentDays = parseInt(this.dzItem.paymentDays) // 付款天数
      const dzStartTime = new Date(this.dzForm.startTime) // 递增开始时间
      const dzPercent = parseFloat(this.dzForm.dz) / 100 // 递增百分比，转换为小数

      // 计算所有可能的递增开始日期
      let possibleDzStartTimes = []
      possibleDzStartTimes.push(this.formatDate(contractStartTime))
      let tempDate = new Date(contractStartTime)
      while (tempDate < contractEndTime) {
        tempDate.setMonth(tempDate.getMonth() + paymentCycle)
        if (tempDate <= contractEndTime) {
          possibleDzStartTimes.push(this.formatDate(new Date(tempDate)))
        }
      }

      // 检查用户输入的递增开始日期是否在可能的日期列表中
      let valid = false
      for (let date of possibleDzStartTimes) {
        if (this.formatDate(new Date(dzStartTime)) == date) {
          valid = true
          break
        }
      }

      if (!valid) {
        this.$message({
          message: '递增开始日期必须是合同开始日期加上付款周期后的第一天',
          type: 'error',
          duration: 1000
        })
        return
      }

      const intervals = []
      let currentStart = new Date(contractStartTime)
      let currentRent = monthlyRent // 当前租金

      while (currentStart < contractEndTime) {
        let currentEnd = new Date(currentStart)
        currentEnd.setMonth(currentStart.getMonth() + paymentCycle)

        // 确保结束时间不超过合同结束时间
        if (currentEnd > contractEndTime) {
          currentEnd = new Date(contractEndTime)
        }

        const interval = {
          start: this.formatDate(currentStart), // 使用自定义格式化方法
          end: this.formatDate(currentEnd), // 使用自定义格式化方法
          paymentDate: null,
          rent: currentRent.toFixed(2),
          increasePercent: 0
        }

        // 计算付款日期
        if (paymentType === '账单开始前') {
          interval.paymentDate = new Date(currentStart)
          interval.paymentDate.setDate(interval.paymentDate.getDate() - paymentDays)
        } else if (paymentType === '账单开始后') {
          interval.paymentDate = new Date(currentStart)
          interval.paymentDate.setDate(interval.paymentDate.getDate() + paymentDays)
        }

        // 将付款日期转换为字符串格式
        interval.paymentDate = this.formatDate(interval.paymentDate)

        // 检查是否需要递增
        if (currentStart >= dzStartTime) {
          currentRent = currentRent * (1 + dzPercent) // 更新当前租金
          interval.increasePercent = dzPercent * 100
        }

        intervals.push(interval)

        // 更新当前开始时间为当前结束时间的下一天
        currentStart = new Date(currentEnd)
        // currentStart.setDate(currentStart.getDate() + 1);
        currentStart.setDate(currentStart.getDate())
      }

      console.log(intervals)

      for (let i = 0; i < this.dataForm.zcgl_htgl_pab_fytk.length; i++) {

        if (this.dzItem.relatedSpace == this.dataForm.zcgl_htgl_pab_fytk[i].relatedSpace) {

          this.dataForm.zcgl_htgl_pab_fytk[i].listDz = intervals

        }

      }
      this.dzDialog = false
      this.$forceUpdate()
      // 这里可以将 intervals 赋值给某个数据属性，以便在前端展示
    },

    formatDate(date) {
      const year = date.getFullYear()
      const month = String(date.getMonth() + 1).padStart(2, '0')
      const day = String(date.getDate()).padStart(2, '0')
      return `${year}-${month}-${day}`
    },

    onClose() {
      this.dzDialog = false

    },

    addDz(item) {

      this.dzDialog = true
      this.dzItem = item
    },

    toJsDj(item) {
      if (item.bhsUnit == null || item.bhsUnit == '') {

        this.$message({
          message: '请先选择租金单价单位！',
          type: 'error',
          duration: 1000
        })
        item.hsUnitPrice = ''
        return
      }


      if (item.relatedSpace == '' || item.relatedSpace == null || item.relatedSpace == undefined) {

        this.$message({
          message: '请先选择关联资产',
          type: 'error',
          duration: 1000
        })
        item.hsUnitPrice = ''
        item.monthlyRent = ''

      }

      if (item.bhsUnit == '0') {

        item.monthlyRent = (item.hsUnitPrice * item.landarea).toFixed(2)
        item.bhsUnitPrice = (item.hsUnitPrice - (item.hsUnitPrice * item.taxRate) / 100).toFixed(2)
      } else {

        item.monthlyRent = item.hsUnitPrice
        item.bhsUnitPrice = (item.hsUnitPrice - (item.hsUnitPrice * item.taxRate) / 100).toFixed(2)

      }

    },

    toGetArea(item) {
      var landarea = this.dataForm.zcglhtglpabspaceList.filter(item => item.id === item.relatedSpace).landarea
      if (landarea == null) {
        item.landarea = 100

      }
    },

    // 计算需要合并的单元格
    getSpanArr(data) {
      data.forEach((item, index) => {
        if (index === 0) {
          this.spanArr.push(1)
          this.position = 0
        } else {
          // 与上一行资产ID相同，合并
          if (data[index].relatedSpace === data[index - 1].relatedSpace) {
            this.spanArr[this.position] += 1
            this.spanArr.push(0)
          } else {
            this.spanArr.push(1)
            this.position = index
          }
        }
      })
    },
    // 定义合并规则
    objectSpanMethod({row, column, rowIndex, columnIndex}) {
      if (columnIndex === 0) {
        const _row = this.spanArr[rowIndex]
        const _col = _row > 0 ? 1 : 0
        return {
          rowspan: _row,
          colspan: _col
        }
      }
    },

    addFytk() {
      this.dataForm.zcgl_htgl_pab_fytk.push({
        relatedSpace: [],
        startTime: null
      })
    },
    removeFytk(index) {
      this.dataForm.zcgl_htgl_pab_fytk.splice(index, 1)
    },

    handleAddList(checkedRow) {
      // 接收子组件传递的 checkedRow 数据
      this.dataForm.zcgl_htgl_pab_space1 = checkedRow
      // 你可以在这里处理接收到的数据
    },
    handleCustomerNameChange(index, row) {
      if (!row.pabCustomerName) {
        // 如果选择的客户名称为空，可以清空其他字段
        row.otherField = ''
        return
      }
      // 调用接口获取其他字段的值
      this.fetchOtherField(row.pabCustomerName).then(response => {

        // 假设接口返回的数据包含 otherField 的值
        row.pabContactNumber = response.data.zcgl_customer_user.contactNumber
      }).catch(error => {
        console.error('Failed to fetch other field:', error)
      })
    },
    getKhList() {

      request({
        url: '/api/example/ZcglCustomer/getAllList',
        method: 'post'
      }).then(res => {
        this.kfList = res.data
      })

    },
    fetchOtherField(customerId) {

      return request({
        url: '/api/example/ZcglCustomer/detail/' + customerId,
        method: 'get'
      })

      // 根据 customerId 调用接口

    },

    judgeShow(id) {
      if (!this.setting.formOperates || !this.setting.formOperates.length) return true
      let arr = this.setting.formOperates.filter(o => o.id === id) || []
      if (!arr.length) return true
      let item = arr[0]
      return item.read
    },
    judgeWrite(id) {

      if (!this.setting.formOperates || !this.setting.formOperates.length) return false
      let arr = this.setting.formOperates.filter(o => o.id === id) || []
      if (!arr.length) return true
      let item = arr[0]
      return !item.write
    },
    getcontractTypeOptions() {
      getDictionaryDataSelector('622532919440706373').then(res => {
        this.contractTypeOptions = res.data.list
      })
    },
    getprojectOptions() {
      getDictionaryDataSelector('622532443626277701').then(res => {
        this.projectOptions = res.data.list
      })
    },
    getpaymentDeadlineTypeOptions() {
      getDictionaryDataSelector('622533108956138312').then(res => {
        this.paymentDeadlineTypeOptions = res.data.list
      })
    },
    getpaymentDeadlineStatusOptions() {
      getDictionaryDataSelector('622533108956138313').then(res => {
        this.paymentDeadlineStatusOptions = res.data.list
      })
    },
    top() {
      if (parseInt(this.activezizgbo) > 0) {
        this.activezizgbo = (parseInt(this.activezizgbo) - 1).toString()
      }
      // this.$emit('refresh')

    },
    createSk() {
      var data = JSON.parse(JSON.stringify(this.dataForm))

      data.zcIds = this.dataForm.zcgl_htgl_pab_space1
        .map(item => item.id) // 提取每个元素的 `id` 字段
        .join(',') // 用逗号拼接成字符串

      for (let i = 0; i < this.dataForm.zcgl_htgl_pab_fytk.length; i++) {
        data.zcgl_htgl_pab_fytk[i].relatedSpace = this.dataForm.zcgl_htgl_pab_fytk[i].relatedSpace.join(',')

      }

      request({
        url: '/api/example/ZcglHtglInfo/createSkjh',
        data: data,
        method: 'post'
      }).then(res => {
        this.skjh = res.data.skjhEntitys

        for (let i = 0; i < this.skjh.length; i++) {
          this.getSpanArr(this.skjh[i].listSk)
        }

        this.loading = false
        this.active = 2
      })

      console.log(JSON.stringify(this.dataForm) + '操你妈')
    },
    // next() {
    //   // this.$emit('refresh')
    //   if (parseInt(this.activezizgbo) < 4) {
    //     this.activezizgbo = (parseInt(this.activezizgbo) + 1).toString()
    //   }
    // },
    init(data) {

      this.dataForm.id = data.id || ''
      this.setting.readonly = true
      // this.setting = data
      this.visible = true
      // this.updateDataRule()
      this.$nextTick(() => {
        this.$refs['elForm'].resetFields()
        if (this.dataForm.id) {
          this.loading = true
          request({
            url: '/api/example/ZcglHtglInfo/' + this.dataForm.id,
            method: 'get'
          }).then(res => {
            this.dataInfo(res.data)
            this.loading = false
            this.skjh = res.data.skjhEntitys
          })
        }
        this.$emit('setPageLoad')
      })
      this.$store.commit('generator/UPDATE_RELATION_DATA', {})
    },
    updateDataRule() {
      // let newRules = {}
      // for (let i = 0; i < this.setting.formOperates.length; i++) {
      //   const item = this.setting.formOperates[i]
      //   if (!item.id.includes('-')) {
      //     const newRulesItem = {
      //       required: item.required,
      //       message: item.name + '不能为空',
      //       trigger: item.trigger || 'blur'
      //     }
      //     if (!this.dataRule.hasOwnProperty(item.id)) {
      //       if (item.required) this.$set(newRules, item.id, [newRulesItem])
      //     } else {
      //       let withoutRequiredItem = true
      //       for (let i = 0; i < this.dataRule[item.id].length; i++) {
      //         if (this.dataRule[item.id][i].hasOwnProperty('required')) {
      //           this.dataRule[item.id][i].required = item.required
      //           withoutRequiredItem = false
      //         }
      //       }
      //       if (withoutRequiredItem && item.required) this.dataRule[item.id].push(newRulesItem)
      //     }
      //   } else {
      //     let key = item.id.split('-')[0]
      //     let newId = item.id.split('-')[1]
      //     let newItem = {
      //       ...item,
      //       id: newId
      //     }
      //     if (!this.tableRequiredData.hasOwnProperty(key)) {
      //       this.$set(this.tableRequiredData, key, [newItem])
      //     } else {
      //       this.tableRequiredData[key].push(newItem)
      //     }
      //   }
      // }
      // this.dataRule = { ...this.dataRule, ...newRules }
    },
    exist() {
      let isOk = true
      for (let key in this.tableRequiredData) {
        if (this.dataForm[key] && Array.isArray(this.dataForm[key])) {
          for (let i = 0; i < this.dataForm[key].length; i++) {
            let item = this.dataForm[key][i]
            inner: for (let id in item) {
              let arr = this.tableRequiredData[key].filter(o => o.id === id) || []
              if (!arr.length) continue inner
              if (arr[0].required) {
                let msg = `${arr[0].name}不能为空`
                let boo = true
                if (arr[0].dataType === 'array') {
                  boo = !this.jnpf.isEmptyArray(item[id])
                } else {
                  boo = !this.jnpf.isEmpty(item[id])
                }
                if (!boo) {
                  this.$message({
                    message: msg,
                    type: 'error',
                    duration: 1000
                  })
                  isOk = false
                  break
                }
              }
            }
          }
        }
      }
      return isOk
    },
    judgeRequired(id) {
      if (!this.formOperates || !this.formOperates.length) return false
      let arr = this.formOperates.filter(o => o.id === id) || []
      if (!arr.length) return false
      let item = arr[0]
      return item.required
    },
    // 表单提交
    dataFormSubmit(eventType, flowUrgent) {
      this.$refs['elForm'].validate((valid) => {
        if (valid) {
          if (this.exist && !this.exist()) return
          if (eventType === 'audit' || eventType === 'reject') {
            this.$emit('eventReceiver', this.dataForm, eventType)
            return
          }

          this.dataForm.status = eventType === 'submit' ? 0 : 1
          this.dataForm.flowId = this.setting.flowId
          this.dataForm.flowUrgent = flowUrgent

          this.eventType = eventType
          if (this.eventType === 'submit') {
            this.$confirm('您确定要提交当前流程吗, 是否继续?', '提示', {
              type: 'warning'
            }).then(() => {
              this.request()
            }).catch(() => {
            })
          } else {
            this.request()
          }
        }
      })
    },
    request() {
      var _data = this.dataList()

      var data = _data
      data.zcIds = this.dataForm.zcgl_htgl_pab_space1
        .map(item => item.id) // 提取每个元素的 `id` 字段
        .join(',') // 用逗号拼接成字符串

      for (let i = 0; i < this.dataForm.zcgl_htgl_pab_fytk.length; i++) {
        data.zcgl_htgl_pab_fytk[i].relatedSpace = this.dataForm.zcgl_htgl_pab_fytk[i].relatedSpace.join(',')

      }

      data.zcgl_htgl_skjh = this.skjh

      if (!this.dataForm.id) {
        request({
          url: '/api/example/ZcglHtglInfo',
          method: 'post',
          data: data
        }).then((res) => {
          this.$message({
            message: res.msg,
            type: 'success',
            duration: 1000,
            onClose: () => {
              this.visible = false
              this.$emit('close', true)
            }
          })
        })
      } else {
        request({
          url: '/api/example/ZcglHtglInfo/' + this.dataForm.id,
          method: 'PUT',
          data: _data
        }).then((res) => {
          this.$message({
            message: res.msg,
            type: 'success',
            duration: 1000,
            onClose: () => {
              this.visible = false
              this.$emit('close', true)
            }
          })
        })
      }
    },
    addzcglhtglpabList() {
      let item = {
        pabCustomerName: undefined,
        pabContactNumber: undefined,
        pabIdType: undefined,
        pabIdNo: undefined,
        pabContactAddress: undefined
      }
      this.dataForm.zcgl_htgl_pab.push(item)
    },
    addzcgl_htgl_qtskzhList() {
      let item = {
        expenseItem: undefined,
        accountName: undefined,
        bankDeposit: undefined,
        accountNumber: undefined
      }
      this.dataForm.zcgl_htgl_qtskzhs.push(item)
    },
    addzcgl_htgl_qtydtkList() {
      let item = {
        clauseContent: undefined
      }
      this.dataForm.zcgl_htgl_qtydtks.push(item)
    },

    delzcglhtglpabList(index) {
      this.dataForm.zcgl_htgl_pab.splice(index, 1)
    },
    addzcglhtglpabspaceList() {
      let item = {
        spaceName: undefined,
        operatingArea: undefined,
        spaceType: undefined,
        rentalStatus: undefined
      }
      // this.dataForm.zcglhtglpabspaceList.push(item)
    },
    delzcglhtglpabspaceList(index) {
      this.dataForm.zcgl_htgl_pab_space1.splice(index, 1)
    },
    openSelectDialog(key) {
      this.currTableConf = this.addTableConf[key]
      this.currVmodel = key
      this.selectDialogVisible = true
      this.$nextTick(() => {
        this.$refs.selectDialog.init()
      })
    },
    addForSelect(data) {
      for (let i = 0; i < data.length; i++) {
        let item = {...this.tableRows[this.currVmodel], ...data[i]}
        this.dataForm[this.currVmodel].push(item)
      }
    },
    dataList() {
      var _data = JSON.parse(JSON.stringify(this.dataForm))

      // _data.ihis = parseInt(_data.ihis)
      //
      // _data.zcgl_htgl_pab_fytk.startTime = _data.jnpf_zcgl_htgl_pab_fytk_jnpf_startTime
      // _data.zcgl_htgl_pab_fytk.endTime = _data.jnpf_zcgl_htgl_pab_fytk_jnpf_endTime
      // _data.zcgl_htgl_pab_fytk.taxRate = _data.jnpf_zcgl_htgl_pab_fytk_jnpf_taxRate
      // _data.zcgl_htgl_pab_fytk.hsUnit = _data.jnpf_zcgl_htgl_pab_fytk_jnpf_hsUnit
      // _data.zcgl_htgl_pab_fytk.bhsUnit = _data.jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit
      // for (let i = 0; i < _data.zcglhtglpabList.length; i++) {
      //   var _list = _data.zcglhtglpabList[i]
      // }
      // for (let i = 0; i < _data.zcgl_htgl_pab_space1.length; i++) {
      //   var _list = _data.zcgl_htgl_pab_space1[i]
      // }
      return _data
    },
    dataInfo(dataAll) {
      let _dataAll = dataAll
      _dataAll.ihis = parseInt(_dataAll.ihis)
      // _dataAll.jnpf_zcgl_htgl_pab_fytk_jnpf_startTime = _dataAll.zcgl_htgl_pab_fytk.startTime
      // _dataAll.jnpf_zcgl_htgl_pab_fytk_jnpf_endTime = _dataAll.zcgl_htgl_pab_fytk.endTime
      // _dataAll.jnpf_zcgl_htgl_pab_fytk_jnpf_taxRate = _dataAll.zcgl_htgl_pab_fytk.taxRate
      // _dataAll.jnpf_zcgl_htgl_pab_fytk_jnpf_hsUnit = _dataAll.zcgl_htgl_pab_fytk.hsUnit
      // _dataAll.jnpf_zcgl_htgl_pab_fytk_jnpf_bhsUnit = _dataAll.zcgl_htgl_pab_fytk.bhsUnit
      // for (let i = 0; i < _dataAll.zcglhtglpabList.length; i++) {
      //   var _list = _dataAll.zcglhtglpabList[i]
      // }
      // for (let i = 0; i < _dataAll.zcgl_htgl_pab_space1.length; i++) {
      //   var _list = _dataAll.zcgl_htgl_pab_space1[i]
      // }

      this.dataForm = _dataAll
      this.dataForm.zcgl_htgl_pab_space1 = this.dataForm.zcgl_htgl_pab_space

      for (let i = 0; i < this.dataForm.zcgl_htgl_pab_space1.length; i++) {
        this.dataForm.zcgl_htgl_pab_space1[i].zcname = this.dataForm.zcgl_htgl_pab_space1[i].zcName
        this.dataForm.zcgl_htgl_pab_space1[i].zcnumber = this.dataForm.zcgl_htgl_pab_space1[i].zcNumber
        this.dataForm.zcgl_htgl_pab_space1[i].id = this.dataForm.zcgl_htgl_pab_space1[i].zcId
      }
      for (let i = 0; i < this.dataForm.zcgl_htgl_pab_fytk.length; i++) {
        this.dataForm.zcgl_htgl_pab_fytk[i].relatedSpace = this.dataForm.zcgl_htgl_pab_fytk[i].relatedSpace.split(",")
      }


    }
  }
}

</script>
<style scoped>
/* 增加表格行高 */
/deep/ .el-table .el-table__row {
  height: 43px; /* 你想要的行高 */
  border: 1px slategrey solid;
  color: black;
}

/* 如果你还想要调整单元格内部的垂直居中 */
/deep/ .el-table .cell {
  font-size: 16px;
  color: black;
  text-align: center;
  height: 43px; /* 和行高一致 */
  line-height: 44px; /* 垂直居中文本 */

}

/deep/ .el-form-item__label {

  color: black;
}

.fixed-bottom {
  z-index: 100;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: white;
  display: flex;
  justify-content: flex-end; /* 按钮靠右对齐 */
  padding: 10px;
  border-top: 1px solid #ccc; /* 可选：添加分割线 */
}

.confirm-button {
  margin-left: 20px;
  padding: 10px 20px;
  background-color: #007BFF;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.confirm-button:hover {
  background-color: #0056b3;
}

.required {
  color: red;
}
/deep/.el-input__inner{
  background: white !important;

}

/deep/.el-textarea__inner{
  background: white !important;
}
</style>
